import request from '@/config/api/http'
import utilRegex from '@/util/util-regex'

const fileUrl = 'http://115.29.192.252:39000/app-bucket/';

export async function buildUrl(key) {
  if (!utilRegex.isHttp(key) && utilRegex.isImg(key)) {
    // const data = await request({
    //   url: `/base/storage/buildUrl/${key}`
    // })
    // return data.data.data
    return fileUrl + key;
  } else {
    return key
  }
}

export function createStorage(data) {
  return request({
    url: '/base/storage/create',
    method: 'post',
    data
  })
}

